Microbial Informatics

Lecture 02

Patrick D. Schloss, PhD (microbialinformatics.github.io)
Department of Microbiology & Immunology

Learning objectives

  • Introduce RStudio
  • Introduce knitr
  • Describe how to generate a document in markdown
  • Differentiate between different flavors of markdown

What is Markdown (*.md)?

  • "Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)." - John Gruber
  • The advantage is that you can read it as a text document and it will make sense and you can use conversion software to generate other file formats including html, pdf, docx
  • Can be rendered using:
    • A Perl script from Gruber
    • RStudio

What's special about R markdown (*.Rmd)?

  • "R Markdown is an authoring format that enables easy creation of dynamic documents, presentations, and reports from R. It combines the core syntax of markdown (an easy-to-write plain text format) with embedded R code chunks that are run so their output can be included in the final document. R Markdown documents are fully reproducible (they can be automatically regenerated whenever underlying R code or data changes)." - RStudio website
  • Keys...
    • Ability to format text
    • Imbed R code and output as chunks or inline

Chunks

plot of chunk unnamed-chunk-1

Inline

  • Let me pick a random number between 1 and 10.
  • Hmmm, I pick 5
  • 5 squared is 25
  • All of the numbers (after 1 and 10) were generated within R
  • The dynamic component is that you use R packages to allow a user to set the min and max values to bound your pick

knitr

  • The chunks and inline approaches are implemented using an R package called knitr
  • We will talk about knitr later when we start digging into R's syntax
  • Documenation and a book (written in knitr) can be found on Yi Hui's website

Syntax

For Friday

  • Install appropriate software that we discussed on Tuesday
  • Get books
  • Sign-up for an account on GitHub
  • Check out Software Carpentry Git tutorial

Questions?